<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="referrer" content="never">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>视频播放器</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }

        html,
        body,
        #player {
            width: 100%;
            height: 100%;
            background-color: rgb(1, 0, 1);
        }
    </style>
</head>

<body>
    <video id="player" muted controls></video>
    <script type="text/javascript" charset="utf-8"
        src="https://vod8.wenshibaowenbei.com/20210617/v1diL8ff/index.m3u8"></script>
    <script>
        function playM3u8(url) {
            const video = document.getElementById('player');
            const m3u8Url = decodeURIComponent(url)
            if (!isPC()) {
                video.setAttribute('src', m3u8Url)
            } else {
                if (Hls.isSupported()) {
                    video.volume = 1.0;
                    const hls = new Hls();
                    hls.loadSource(m3u8Url);
                    hls.attachMedia(video);
                    hls.on(Hls.Events.MANIFEST_PARSED, () => {
                        video.play();
                    });
                }
            }
        }

        function getUrlParam(name) {
            const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            const r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]); return null;
        }

        function isPC() {
            const userAgentInfo = navigator.userAgent;
            const Agents = ["Android", "iPhone",
                "SymbianOS", "Windows Phone",
                "iPad", "iPod"];
            let flag = true;
            for (let v = 0; v < Agents.length; v++) {
                if (userAgentInfo.indexOf(Agents[v]) > 0) {
                    flag = false;
                    break;
                }
            }
            return flag;
        }

        window.onload = () => {
            const url = getUrlParam('url') || "https://vod8.wenshibaowenbei.com/20210617/v1diL8ff/index.m3u8"
            playM3u8(url);
        }
    </script>
</body>

</html>